var TreeUtil = {
    /**
     * 获取全路径
     * @param treeObj
     * @param flag id、name等等树节点属性
     * @returns {*}
     */
    getNamePath:function (treeObj,flag){
        if(treeObj==null)return "";
        var filename = treeObj.flag;
        var pNode = treeObj.getParentNode();
        if(pNode!=null){
            filename = TreeUtil.getNamePath(pNode,flag) +">>"+ filename;
        }
        return filename;
    },

    /**
     * 获取当前节点的根节点
     * @param treeNode
     * @returns {*}
     */
    getCurrentRoot:function(treeNode){
        if(treeNode.getParentNode()!=null){
            var parentNode = treeNode.getParentNode();
            return ZtreeUtil.getCurrentRoot(parentNode);
        }else{
            return treeNode;
        }
    },

    /**
     * 遍历树形List-->>children，取出匹配到id相等的节点以及子节点（场景：树形结构编辑）
     * @param data
     * @param id
     * @returns {*}
     */
    eliminateTreeNodes:function(data,id){
        for (var i in data) {
            if (data[i].id == id) {
                console.log(data[i].id);
                data.splice(i,1);//删除重读节点
                break;
            } else {
                TreeUtil.eliminateTreeNodes(data[i].children, id);
            }
        }
        return data;
    }
}